//
//  customTableViewCell.m
//  Cars' home
//
//  Created by dapeng on 15/11/29.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "customTableViewCell.h"
#import "Theme-PrefixHeader.pch"
#define width self.frame.size.width
#define height self.frame.size.height
@implementation customTableViewCell
//- (void)dealloc {
//    [_oneImage release];
//    [_topLabel release];
//    [_footLabel release];
//    [_commentLabel release];
//    [super dealloc];
//}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.oneImage = [[UIImageView alloc] init];
        self.topLabel = [[UILabel alloc] init];
        self.footLabel = [[UILabel alloc] init];
        self.commentLabel = [[UILabel alloc] init];
        
        [_oneImage release];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
        [self addSubview:self.oneImage];
        [self addSubview:self.topLabel];
        [self addSubview:self.footLabel];
        [self addSubview:self.commentLabel];
        [_oneImage release];
        [_topLabel release];
        [_footLabel release];
        [_commentLabel release];
    }return self;
}





- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.oneImage.frame = CGRectMake(10, 10, 90, 70);
    self.topLabel.frame = CGRectMake(110, 10, width - 130, 50);
    self.footLabel.frame = CGRectMake(110, 65, 100, 15);
    self.commentLabel.frame = CGRectMake(width - 100, 65, 100, 15);
}

- (void)setTwoModel:(recommentTwoModel *)twoModel {
    if (_twoModel != twoModel) {
        [_twoModel release];
        _twoModel = [twoModel retain];
    
    }
    [self.oneImage sd_setImageWithURL:[NSURL URLWithString:twoModel.smallpic] placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    self.topLabel.text = twoModel.title;
    self.footLabel.text = twoModel.time;
    self.commentLabel.text = [NSString stringWithFormat:@"%@评论", twoModel.replycount];
    self.topLabel.font = [UIFont systemFontOfSize:18];
    self.footLabel.font = [UIFont systemFontOfSize:14];
    self.commentLabel.font = [UIFont systemFontOfSize:14];
    self.commentLabel.textAlignment = NSTextAlignmentRight;
    self.footLabel.alpha = 0.5;
    self.commentLabel.alpha = 0.5;
    self.topLabel.numberOfLines = 0;
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [user objectForKey:@"nightModel"];
    
    if (!(passWord == nil) && [passWord isEqualToString:@"day"]) {
        self.backgroundColor = [UIColor colorWithWhite:0.126 alpha:1.000];
        self.topLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.footLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        self.commentLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        
    }else{
        self.topLabel.textColor = [UIColor blackColor];
        self.backgroundColor = [UIColor whiteColor];
        
    }
}














- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
